<?php
//debug($params);
//echo $html->link("reload",);
//echo $html->link("reload",array("action"=>"file","url"=>$params["pass"]));
echo $form->create("Tiarra",array("action"=>"post","url"=>array($params["pass"][0],$params["pass"][1])));
echo $form->input("notice",array("type"=>"checkbox","value"=>1,"div"=>false));
echo $form->input("msg",array("label"=>false));

echo $form->hidden("path",array("value"=>$this->params["url"]["url"]));

echo $form->submit("Send",array("div"=>false));
echo $form->end();
echo $html->link("reload","/".$this->params["url"]["url"]);
echo "<br />";

$options = array(
//  "totalItems" => 200,
  "itemData"=>$content,
  "delta" => 10,
  "perPage" => 50,
  "path" => $this->here,
);

//debug($this->here);
//debug($this->params);
$pager =& Pager::factory($options);
//debug($pager);
$navi = $pager -> getLinks();
//debug($navi);


//echo $html->para("navi",$navi["all"]);
$prev_name = "";
if(count($content)){
	$offset = (intval(@$this->params["url"]["pageID"]) ) * $options["perPage"] ;
	for($i=$offset; $i<($offset+$options["perPage"]); $i++){
	//foreach($content as $c){
		if(empty($content[$i])){
			break;
		}
		$c = $content[$i];
		echo '<p style=" margin-top:10px;">';
		echo '<span style="font-size:small; color:#11972D;">';
		echo $c["date"];
		echo " ";
		if(substr($c["name"],0,1) == "("){
			$notice = 1;
			$color = "color:#ccc;";
		}else{
			$notice = 0;
			$color= "";
		}
//		$c["name"] = substr($c["name"],(strstr($c["name"],"@")),-1);
		if(strlen($c["name"]) > 4){
		$c["name"] = substr($c["name"],1,-1);
		list($channel,$name) = explode("@",$c["name"]);
		//$name = substr($c["name"],strstr($c["name"],"=3a=2a")+1,-1);
		if($name != $prev_name){
			echo $name;
			echo strrchr($c["msg"],$this->params["pass"][0]);
		}
		$prev_name = $name;
		}
		echo '</span>';
		echo '<br />';
		echo '<span style="font-size:medium; '.$color.'; margin-bottom:10px;">';
		echo $text->autoLink($c["msg"]);
		echo '</span>';
		echo "</p>";
	}

}
echo "<hr />";
if(!empty($navi["linkTagsRaw"]["prev"]) || !empty($navi["linkTagsRaw"]["next"])){

echo '<p style="text-align:center;">';
if(!empty($navi["linkTagsRaw"]["prev"])){
echo '<a href="'.$navi["linkTagsRaw"]["prev"]["url"].'" accesskey="*">'.__($navi["linkTagsRaw"]["prev"]["title"],true).'</a>'; 
echo "&nbsp;";
}
if(!empty($navi["linkTagsRaw"]["next"])){
echo '<a href="'.$navi["linkTagsRaw"]["next"]["url"].'" accesskey="#">'.__($navi["linkTagsRaw"]["next"]["title"],true).'</a>';
}
echo "</p>";
}

echo "<hr />";
echo $html->para("navi",$navi["pages"],array("style"=>"text-align:center;"));

echo "<hr />";
echo $this->renderElement('channel_list');
?>
